In combinatorics, a square-free word is a word that does not contain any subword twice in a row. There exist infinite square-free words in any alphabet with three or more symbols, as proved by Axel Thue[1] [2]. To build an infinite square-free word in the alphabet {a, b, c}, let be any word starting with the letter a. Define the words recursively as follows: the word is obtained from by replacing each a in with abcbacbcabcba, each b with bcacbacabcacb, and each c with cabacbabcabac (this example was found by J. Leech [3]). It is possible to check that the sequence converges to the infinite square-free word abcbacbcabcbabcacbacabcacbcabacbabcabacbcacbacabcacb...
Over a two-letter alphabet {a, b} the only square-free words are the empty word and a, b, ab, ba, aba, and bab. There is, however, an infinite cube-free word: the Thue-Morse sequence.
The Thue number of a graph G is the smallest number k such that G has a k-coloring for which the sequence of colors along every non-repeating path is squarefree.